#include <iostream>
#include <set>
using std::cout;
using std::endl;
using std::set;

template <class T>
T & add(T & t1,const T & t2)
{
    return t1 += t2;
}

template <>
set<int> & add<set<int>>(set<int> & lhs, const set<int> & rhs)
{
    lhs.insert(rhs.begin(),rhs.end());
    return lhs;
}

void test0(){
    int ix = 4, iy = 7;
    double dx = 8.6, dy = 7.5;
    cout << add(ix,iy) << endl; 
    cout << add(dx,dy) << endl; 

    set<int> nums1 = {1,2,3,4};
    set<int> nums2 = {5,9,1,4};

    add<set<int>>(nums1,nums2);
    for(auto & ele : nums1){
        cout << ele << " ";
    }
    cout << endl;
}

int main(void){
    test0();
    return 0;
}

